package com.bringway.p2p.service.impl;

import java.util.List;
import java.util.Map;

import org.apache.commons.collections.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.bringway.p2p.dao.ImageDao;
import com.bringway.p2p.service.ImageService;

import net.sf.json.JSONObject;

@Service
public class ImageServiceImpl implements ImageService {
	
	@Autowired
	private ImageDao imageDao;

	@Override
	public boolean insertImage(Map<String, Object> paramMap) {
		// TODO Auto-generated method stub
		return imageDao.insertImage(paramMap)>0;
	}

	@Override
	public List<Map<String, Object>> queryImagesList(JSONObject params) {
		return imageDao.queryImagesList(params);
	}

	@Override
	public int getImagesCount(JSONObject params) {
		return imageDao.getImagesCount(params);
	}

	@Override
	public boolean updateImages(Map<String, Object> paramMap) {
		return imageDao.updateImages(paramMap)>0;
	}

	@Override
	public boolean publicImage(Map<String, Object> paramMap) {
		int count= this.imageDao.updateAllImages(paramMap);
		if (count>0) {
			return imageDao.publicImages(paramMap)>0;
		} else {
			return imageDao.publicImages(paramMap)>0;
		}
	}

	@Override
	public boolean HuiShouImage(Map<String, Object> paramMap) {
		return imageDao.HuiShouImage(paramMap)>0?true:false;
	}

	@Override
	public boolean updateAllImages(Map<String, Object> paramMap) {
		return imageDao.updateAllImages(paramMap)>0;
	}

}
